package c.e.a.c.l;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.RippleDrawable;
import android.widget.TextView;
import b.i.b.f;
import b.i.k.o;
import c.e.a.c.b;
import c.e.a.c.t.g;
import c.e.a.c.t.j;
import java.util.WeakHashMap;

/* compiled from: CalendarItemStyle */
public final class a {
    public final Rect a;
    public final ColorStateList b;
    public final ColorStateList c;
    public final ColorStateList d;
    public final int e;
    public final j f;

    public a(ColorStateList colorStateList, ColorStateList colorStateList2, ColorStateList colorStateList3, int i, j jVar, Rect rect) {
        f.L(rect.left);
        f.L(rect.top);
        f.L(rect.right);
        f.L(rect.bottom);
        this.a = rect;
        this.b = colorStateList2;
        this.c = colorStateList;
        this.d = colorStateList3;
        this.e = i;
        this.f = jVar;
    }

    public static a a(Context context, int i) {
        if ((i != 0 ? 1 : null) != null) {
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(i, b.o);
            Rect rect = new Rect(obtainStyledAttributes.getDimensionPixelOffset(0, 0), obtainStyledAttributes.getDimensionPixelOffset(2, 0), obtainStyledAttributes.getDimensionPixelOffset(1, 0), obtainStyledAttributes.getDimensionPixelOffset(3, 0));
            ColorStateList j = c.e.a.c.a.j(context, obtainStyledAttributes, 4);
            ColorStateList j2 = c.e.a.c.a.j(context, obtainStyledAttributes, 9);
            ColorStateList j3 = c.e.a.c.a.j(context, obtainStyledAttributes, 7);
            int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(8, 0);
            j a = j.a(context, obtainStyledAttributes.getResourceId(5, 0), obtainStyledAttributes.getResourceId(6, 0), new c.e.a.c.t.a((float) null)).a();
            obtainStyledAttributes.recycle();
            return new a(j, j2, j3, dimensionPixelSize, a, rect);
        }
        throw new IllegalArgumentException("Cannot create a CalendarItemStyle with a styleResId of 0");
    }

    public void b(TextView textView) {
        g gVar = new g();
        g gVar2 = new g();
        gVar.setShapeAppearanceModel(this.f);
        gVar2.setShapeAppearanceModel(this.f);
        gVar.p(this.c);
        gVar.s((float) this.e, this.d);
        textView.setTextColor(this.b);
        RippleDrawable rippleDrawable = new RippleDrawable(this.b.withAlpha(30), gVar, gVar2);
        Rect rect = this.a;
        InsetDrawable insetDrawable = new InsetDrawable(rippleDrawable, rect.left, rect.top, rect.right, rect.bottom);
        WeakHashMap weakHashMap = o.a;
        textView.setBackground(insetDrawable);
    }
}
